package threadsOff;

public class ThreadOffClient {
	private volatile boolean offFlag = false;
	private volatile Integer count = 0;
	private Runnable runnable = new Runnable() {

		@Override
		public void run() {
			count++;
			System.out.println(Thread.currentThread().getName() 
					+ " ; offFlag : " + offFlag + " ; count : " + count);

			while (offFlag) {
				return;
			}
			System.out.println(offFlag);

		}
	};

	public static void main(String[] args) {
		ThreadOffClient threadOffClient = new ThreadOffClient();

		for (int i = 0; i < 3; i++) {
			Thread thread = new Thread(threadOffClient.runnable);
			thread.start();

			// if (i == 2) {
			// threadOffClient.offFlag = true;
			// }

		}
	}
}
